IF EXISTS ( SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[MyProc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1 ) BEGIN DROP PROCEDURE [dbo].[MyProc] END